<template>
  <div class="arrymdiv">
    <div class="descriptions">
      <el-descriptions title="添加课程" direction="vertical" :column="3" :size="3" border>
        <el-descriptions-item label="名称" :span="1"><el-input v-model="kcname" placeholder="课程名称" /></el-descriptions-item>
        <el-descriptions-item label="课程图片"
          ><el-upload ref="upload" class="upload-demo" action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15" :limit="1" :auto-upload="false">
            <template #trigger>
              <el-button type="primary">选择图片</el-button>
            </template>
          </el-upload></el-descriptions-item
        >
        <el-descriptions-item label="是否公开" :span="1">
          <el-switch v-model="ispublic" style="--el-switch-on-color: #13ce66" inline-prompt active-text="是" inactive-text="否"
        /></el-descriptions-item>
        <el-descriptions-item label="选择角标" :span="1">
          <el-select v-model="value" multiple placeholder="角标" style="width: 240px"> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /> </el-select
        ></el-descriptions-item>
        <el-descriptions-item label="描述" :span="4">
          <el-input v-model="kcname" placeholder="描述" />
        </el-descriptions-item>
        <el-descriptions-item label="章节" :span="5">
          <el-button class="tablebutton" @click="$router.push({ name: 'addchapter' })" type="primary">添加章节</el-button>
          <el-table :data="tableData" style="width: 100%" :row-style="{ height: '60px' }">
            <el-table-column align="center" type="index" label="序号" width="100" />
            <el-table-column align="center" prop="name" label="章节昵称" />
            <el-table-column align="center" prop="name" label="文件名" />
            <el-table-column fixed="right" align="center" label="操作" width="200">
              <template #default>
                <el-button type="danger" size="small">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-descriptions-item>
        <el-descriptions-item label="操作"><el-button type="primary">添加</el-button></el-descriptions-item>
      </el-descriptions>
    </div>
  </div>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
import { reactive, toRefs } from '@vue/reactivity';
export default defineComponent({
  setup() {
    const data = reactive({
      kcname: '',
      ispublic: false,
      tableData: [
        {
          name: '第一次课',
        },
        {
          name: '第二次课',
        },
      ],
      options: [
        {
          value: '推荐',
          label: '推荐',
        },
        {
          value: '热门',
          label: '热门',
        },
      ],
      value: '',
    });
    return {
      ...toRefs(data),
    };
  },
});
</script>

<style scoped>
.descriptions {
  padding: 20px;
}
.tablebutton {
  float: right;
}
.arrymdiv {
  border-radius: 10px;
  margin: 1px;
  background-color: rgb(255, 255, 255);
  box-shadow: 1px 1px 5px #cfcfcf;
}
</style>
